/*
   @Copyright:LeetCode
   @Author:   tjyemail
   @Problem:  http://leetcode.com/problems/largest-number
   @Language: C++
   @Datetime: 19-12-03 13:36
   */

class Solution {
	static bool greater(const int &i, const int &j){
		return to_string(i)+to_string(j)>to_string(j)+to_string(i);
	}
public:
	string largestNumber(vector<int>& nums) {
		sort(nums.begin(),nums.end(),greater);
		string res;
		for(int i=0; i<nums.size(); res.append(to_string(nums[i++])));
		if(res.length()<0 || res[0]=='0') res="0";
		return res;
	}
};

